Real estate in Zürich

Zürich Statistical Office collects data on city and its residents. This data is published as Linked Data.

In this tutorial, we will show how to work with Linked Data. Mainly, we will see how to work with real estate dataset.
We will look into how to query, process, and visualize it.

1. Housing prices
      1.1 Prices per apartment type
      1.2 Prices per district
      1.3 Prices per district and apartment type
      1.4 Prices over time
      1.5 Prices over time for various apartment types
2. Apartments and population growth
3. Apartment types over time

SPARQL endpoint

Data on real estate market is published as Linked Data. It can be accessed with SPARQL queries.
You can send queries using HTTP requests. The API endpoint is https://ld.stadt-zuerich.ch/query/.

Let's use SparqlClient from graphly to communicate with the database. Graphly will allow us to:

SPARQL queries can become very long. To improve the readibility, we will work wih prefixes.

Using add_prefixes method, we define persistent prefixes. Every time you send a query, graphly will add automatically update the prefixes for you.

Housing prices

Let's find the average price per m2 for an apartment in Zurich. This data is available in QMP-EIG-HAA-OBJ-ZIM data cube. It will allow us to find the price per city district and apartment type. Thea data is also available at different points in time.

The query for housing prices in city of Zurich for different districts and apartment types over time is:

Prices per apartment type

Let's visualize housing prices per apartment type. To do this, we will aggregate the prices per rooms.
The cleaned dataframe becomes:

Prices per district

Let's visualize housing prices per district. To do this, we will aggregate the prices per place.
The cleaned dataframe becomes:

Prices per district and apartment type

Now, let's combine both views. We will visualize housing prices across districts and apartment types.
The plotting dataframe becomes:

City districts

drawing

Prices over time

Let's take a look at averge housing prices over time. We will aggregate te results by time.
The plotting dataframe becomes:

Prices over time for various apartment types

Now that we have seen the trend, let's dig a bit deeper. We will visualize housing prices over time for 2, 4and 6-rooms apartments. To do it, we need to reshape our dataframe to show prices per apartment type over time.

The reshaped dataframe becomes:

Apartments and population growth

The real estate prices are influenced by:

Let's take a look at how those numbers it evolved over time. Mainly, we want find the apartments and population count in city of Zurich.

The query for number of inhabitants and apartments over time is:

Apartment types over time

Let's take a look at what apartments were, and are available in Zurich. How did the share of various apparmnent types evolve over time? Is there a trend to build more smaller (or bigger) apartments? These insights are available in WHG-ZIM data cube.

The query for number of different apartment types over time is:

Let's reshape our dataframe to show the apartment count per apartment type, over time: